package com.share.service;

import com.share.bean.Person;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;


/**
 * author:caifan
 * date:2019/8/23
 */
@Service
public class PersonServiceImpl implements PersonService, InitializingBean, DisposableBean {

    public PersonServiceImpl() {
        System.out.println("personServiceImpl constructor");
    }

    @PostConstruct
    public void initPerson() {
        System.out.println("postConstruct ...");
    }

    @Override
    public Person getPersonByName(String name) {
        Person person = new Person();
        person.setName("java");
        return person;
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("personServiceImpl destroy");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("personServiceImpl after");
    }
}
